package com.person.yan.takeout2017.view.activity;

import android.app.Notification;
import android.app.NotificationManager;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.NotificationCompat;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.Gson;
import com.person.yan.takeout2017.R;
import com.person.yan.takeout2017.bean.HomeData;
import com.person.yan.takeout2017.bean.ResponseInfo;
import com.person.yan.takeout2017.net.HttpUtils;
import com.person.yan.takeout2017.net.InfoConvertDataUtils;
import com.person.yan.takeout2017.net.TakeOutApi;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import retrofit2.Call;

public class HomeActivity extends AppCompatActivity {

//    @BindView(R.id.activity_request_tv_btn)
//    TextView activityRequestTvBtn;
//    @BindView(R.id.activity_nitification_tv_btn)
//    TextView activityNitificationTvBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);


    }

    @Override
    protected void onStart() {
        super.onStart();
    }


//    @OnClick(R.id.activity_request_tv_btn)
//    public void requestService() {
//        TakeOutApi takeOutApi = HttpUtils.getApi();
//        Call<ResponseInfo> call = takeOutApi.getHomeData();
//        call.enqueue(new InfoConvertDataUtils<ResponseInfo>() {
//            @Override
//            public void showError(Throwable e) {
//                e.printStackTrace();
//                Toast.makeText(getApplicationContext(), "出现问题", Toast.LENGTH_SHORT).show();
//            }
//
//            @Override
//            public void showData(String json) {
//                HomeData homeData = new Gson().fromJson(json, HomeData.class);
//                Toast.makeText(getApplicationContext(), homeData.toString(), Toast.LENGTH_SHORT).show();
//
//            }
//        });
//
//    }
//
//    @OnClick(R.id.activity_nitification_tv_btn)
//    public void sendingNotification() {
//        NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
//        NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
//        Notification notification = builder.setSmallIcon(R.mipmap.ic_launcher)
//                .setAutoCancel(true)
//                .setPriority(NotificationCompat.PRIORITY_MAX)
//                .setLargeIcon(BitmapFactory.decodeResource(this.getResources(), R.mipmap.ic_launcher))
//                .setTicker("Ticker")
//                .setContentTitle("ContentTitle")
//                .setContentText("ContentText")
//                .setWhen(System.currentTimeMillis()).build();
//        //.setSound(sound)
//                //.setContentIntent(pIntent);
//
//        manager.notify(1 , notification);
//    }
}
